﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class GameOverPanel : BasePanel
{


    // Start is called before the first frame update
    void Start()
    {       
    }

    // Update is called once per frame
    void Update()
    {       
    }
    public override void OnEnter()
    {
        Camera.main.GetComponent<AudioSource>().Stop();
        EffectObjectManager.Instance.CreateEffectObject("Prefabs/Effect/LostGameSound", Vector3.zero);
        GameManager.Instance.ChangeState(StateOP.Push, GameState.End);
    }

    public override void OnPause()
    {
    }

    public override void OnResume()
    {
    }

    public override void OnExit()
    {

    }

    public void Button1() //重新开始游戏
    {
        EffectObjectManager.Instance.ButtonEffects();
        UIManager.Instance.PopPanel();
        if (SaveManager.Instance.HasSaveFile())
        {
            SaveManager.Instance.LoadGame();
        }
        GameManager.Instance.Restart();
    }
    public void Button2() //退出至主菜单
    {
        EffectObjectManager.Instance.ButtonEffects();
        UIManager.Instance.PopPanel();
        GameManager.Instance.ChangeState(StateOP.Push, GameState.Ready);
    }
    public void Button3()  //退出游戏
    {
        EffectObjectManager.Instance.ButtonEffects();
        #if UNITY_EDITOR
        UnityEditor.EditorApplication.isPlaying = false;
        #else
            Application.Quit();
        #endif
    }

 
}
